package com.sdygmedia.service.impl;

import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.sdygmedia.dao.CategoryDao;
import com.sdygmedia.domain.Admin;
import com.sdygmedia.domain.Category;
import com.sdygmedia.service.CategoryService;

@Service
@Transactional
public class CategoryServiceImpl implements CategoryService {

	@Resource
	private CategoryDao categoryDao;

	@Override
	public List<Category> findAll() {
		// TODO Auto-generated method stub
		return categoryDao.findAll();
	}

	@Override
	public void delete(long id) {
		// TODO Auto-generated method stub
		categoryDao.delete(id);
	}

	@Override
	public void save(Category category) {
		// TODO Auto-generated method stub
		
		category.setDate(new Date());
		
		categoryDao.save(category);
	}

	@Override
	public Category getById(long id) {
		// TODO Auto-generated method stub
		return categoryDao.getById(id);
	}

	@Override
	public void update(Category category) {
		// TODO Auto-generated method stub
		category.setDate(new Date());
		categoryDao.update(category);
	}
	
}
